/*
 * ComplexService.java
 *
 * Created on 02 December 2007, 19:34
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package googlecode.menagerie.axis2.pojo.complex;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author sowen
 */
public class ComplexService {
    
    public Person createPerson() {
        Person result = new Person();
        Address address = new Address();
        
        address.setCity("London");
        address.setRoadNumber(22);
        address.setRoad("High Street");
        
        result.setAddress(address);
        result.setFirstName("Bob");
        result.setLastName("Monkhouse");
        result.setAge(56);
        
        return result;
    }

    public ComplexWithInternalList getComplexWithInternalList() {
        return new ComplexWithInternalList();
    }
    
    public String personToString(Person person) {
        return person.toString();
    }
    
    public Person [] getPersonArray(int size) {
        Person [] result = new Person[size];
        for (int i=0;i<size;i++) {
            result[i]=createPerson();
        }
        return result;
    }
	
    public int countPeopleArray(Person [] people) {
	if (people == null) return 0;
	return people.length;
    }
	
    public int countPeopleList(List<Person> people) {
	if (people == null) return 0;
	return people.size();
    }
    
    public List<Person> getPersonList(int size) {
        List<Person> result = new ArrayList<Person>();
        for (int i=0;i<size;i++) {
            result.add(createPerson());
        }
        return result;
    }
    
//    public Friend getCyclic() {
//        Friend a = new Friend();
//        Friend b = new Friend();
//        Friend c = new Friend();
//        a.setFirstName("a");
//        a.setLastName("a");
//        a.setAge(22);
//        
//        b.setFirstName("b");
//        b.setLastName("b");
//        b.setAge(32);
//        
//        c.setFirstName("c");
//        c.setLastName("c");
//        c.setAge(42);
//        
//        a.setFriend(b);
//        b.setFriend(c);
//        c.setFriend(a);
//     
//        return a;
//    }
    
}
